package com.bw.park.ui.home;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.webkit.JavascriptInterface;

import com.bw.park.R;
import com.bw.park.widget.WebViewJavaScriptFunction;
import com.bw.park.widget.X5WebView;
import com.tencent.smtt.sdk.WebView;
import com.tencent.smtt.sdk.WebViewClient;

import org.jetbrains.annotations.Nullable;

public class MainActivity extends AppCompatActivity implements WebViewJavaScriptFunction {

    private X5WebView x5WebView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        x5WebView = findViewById(R.id.main_x5web);
        x5WebView.addJavascriptInterface(this,"androidinfo");
        x5WebView.loadUrl("http://118.195.161.134:8077/index.html");
    }

    @Override
    public void onJsFunctionCalled(@Nullable String tag) {

    }

    //注册要监听的js事件
    @JavascriptInterface
    public void androidparking(String id){
        Log.e("ZXY","androidparking->"+id);
    }
    @JavascriptInterface
    public void androidapply(String id){
    }
    @JavascriptInterface
    public void androidvisit(String id){
    }
    @JavascriptInterface
    public void androidpatrol(String id){
    }
    @JavascriptInterface
    public void androidnews(String id){
    }
    @JavascriptInterface
    public void androidnoticelist(String id){
    }
    @JavascriptInterface
    public void androidrepair(String id){
    }
    @JavascriptInterface
    public void androidaddrepair(String id){
    }
    @JavascriptInterface
    public void androidaddculture(String id){
        //添加文化
    }
    @JavascriptInterface
    public void androidaddnotice(String id){
        //发公告
    }
    @JavascriptInterface
    public void androidculture(String id){
        //文化审核
    }
    @JavascriptInterface
    public void androidnotice(String id){
        //公告管理
    }
    @JavascriptInterface
    public void androidsign(String id){
    }
    @JavascriptInterface
    public void androidattendance(String id){
    }
    @JavascriptInterface
    public void androidproperty(String id){
    }
    @JavascriptInterface
    public void androidcheckculture(String id){
        //文化审核
    }
    @JavascriptInterface
    public void androidpeople(String id){
    }

}